<?php
require_once('../phpmailer/class.phpmailer.php');
require_once('../phpmailer/class.smtp.php'); 
$email = $_POST["txtMail"];
$headers = "From: " . $_POST["txtMail"];
$ip = $_SERVER["REMOTE_ADDR"];
$host = gethostbyaddr($ip);
$message = $_POST["txtMessage"];
$name = $_POST["txtName"];
$chucvu = $_POST["txtChucvu"];
$company = $_POST["txtCompany"];
$tel = $_POST["txtTel"];
$mob = $_POST["txtMob"];
$address = $_POST["txtAddress"];
$way = $_POST["txtWay"];
$subject = $header;
$time = date("l d F Y @ H:i");
$to = "trungvdt49@gmail.com";
$body = "Email: " . $email 
. "\nHost: " . $host 
. "\nIP: " . $ip 
. "\nName: " . $name 
. "\nChuc vu: " . $chucvu 
. "\nCompany: " . $company
. "\nTel: " . $tel
. "\nMobile: " . $mob
. "\nAddress: " . $address
. "\nInterested: " . $way
. "\nTime: " . $time
. "\nMessage: " . $message;
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 1;
$mail->Host = "smtp.gmail.com";
$mail->Port = 465; 
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Username = 'ochuotdong@gmail.com';
$mail->Password = '6loc8phat';
$mail->AddAddress($to,"Vu Dinh Trung");
$mail->Subject=$subject;
$mail->CharSet = "utf-8";
$mail->Body = $body;
    
if(!$mail->Send()) {
    echo "Mailer Error: " . $mail->ErrorInfo;
} 
else {
    echo "Message Sent!";
}
?>
